// 定义数据源及模块配置mock数据

const moduleCateTemplate = [
	{
		"cateId": 1,
		"categoryName": "设计师模块",
		"moduleList": []
	}
]

const tabTemplate = {
    "id": "settingNameTab1",
    "title": "tab标题",
    "properties": []
}

/**
 * 新版水滴格式配置项描述文件
 */
const EditPropertyJsonMap = {
    "J_LINK_TEXT": {
        "title": "显示文案",
        "fieldKey": "linkTextData",
        "type": "text",
        "default": "默认值",
        "requiredMsg": "必填",
        "ui": {
            "type": "J_LINK_TEXT",
            "maxlength": 25,
            "char2Modal": true,
            "placeholder": "请输入文本",
            "description": {
                "title": "提示：请输入不超过25个字符"
            }
        }
    },
    "J_TEXT_AREA": {
        "title": "多行文本框",
        "fieldKey": "textAreaData",
        "type": "text",
        "default": "默认值",
        "requiredMsg": "必填",
        "ui": {
            "type": "J_TEXT_AREA",
            "maxlength": 100,
            "autofocus": false,
            "cols": 3,
            "rows": 5,
            "placeholder": "文本输入",
            "description": {
                "title": "描述提示"
            }
        }
    },
    "J_NORMAL_COLOR": {
        "fieldKey": "colorData",
        "title": "颜色",
        "type": "text",
        "default": "#000000",
        "requiredMsg": "必填",
        "ui": {
            "type": "J_NORMAL_COLOR",
            "description": {
                "title": "描述提示"
            }
        }
    },
    "J_DATE_TIME": {
        "fieldKey": "dateTimeData",
        "title": "日期选择框",
        "type": "text",
        "default": "2022-06-24 00:00:00",
        "requiredMsg": "必填",
        "ui": {
            "type": "J_DATE_TIME",
            "description": {
                "title": "描述提示"
            }
        }
    },
    "J_ADV_MATERIAL": {
        "fieldKey": "bannerData",
        "title": "轮播图",
        "type": "jsonArray",
        "requiredMsg": "必填",
        "ui": {
            "type": "J_ADV_MATERIAL",
            "max": "8",
            "description": {
                "title": "描述字段"
            }
        }
    }
}

/**
 * 旧版现在后端返回的配置项格式
 */
const ModuleConfigMap = {
    "J_LINK_TEXT": {
        "datasource": "J_LINK_TEXT",
        "name": "linkTextData",
        "noConfig": false,
        "title": "显示文案",
        "validate": {
            "must": true
        }
    },
    "J_TEXT_AREA": {
        datasource: "J_TEXT_AREA",
        name: "textAreaData",
        title: "多行文本框",
        noConfig: false,
        validate: {
            must: true
        },
        formType: {
            type: "textarea"
        },
    },
    "J_NORMAL_COLOR": {
        datasource: "J_NORMAL_COLOR",
        name: "colorData",
        title: "颜色",
        noConfig: false,
        validate: {
            must: true
        },
        formType: {
            type: "color"
        }
    },
    "J_DATE_TIME": {
        datasource: "J_DATE_TIME",
        name: "dateTimeData",
        title: "时间类型",
        noConfig: false,
        validate: {
            must: true
        },
        formType: {
            type: "datetime"
        }
    },
    "J_ADV_MATERIAL": {
        datasource: "J_ADV_MATERIAL",
        name: "bannerData",
        title: "轮播图",
        noConfig: false,
        validate: {
            must: true,
            height: "390",
            width: "960",
        }
    }
}

/**
 * 配置默认mock数据
 */
const ConfigDataMap = {
    "J_LINK_TEXT": {
        "linkTextData": {
            "text": "文本demo",
            "linkInfo": {
                "link": "//conecli.com/shopcard/?channel=4402",
                "linkType": 8,
                "originalData": "//conecli.com/shopcard/?channel=4402"
            }
        }
    },
    "J_TEXT_AREA": {
        "textAreaData": "多行文本demo"
    },
    "J_NORMAL_COLOR": {
        "colorData": "#E71D1D"
    },
    "J_DATE_TIME": {
        "dateTimeData": "2022-07-07 00:00:00"
    },
    "J_ADV_MATERIAL": {
        "bannerData": {
            "showNum": 4,
            "bi": 0,
            "materialCode": "4m72LCazMQrbF",
            "moduleCreate": 1,
            "type": "2"
        }
    }
}

/**
 * nodeText数据示例
 */
const DataDefinesNodeTextMap = {
    "J_LINK_TEXT": {
        "middleName": "linkTextData",
        "middleType": "J_LINK_TEXT",
        "name": "text",
        "nodeText": {
            "data": {
                "configDataValue": {
                    "clickUrl": "javascript:;",
                    "shopDetail": "176343"
                },
                "configDataType": 9
            },
            "text": "文本demo",
            "dataSourceType": 0
        },
        "propertyName": "显示文案",
        "requried": true,
        "type": "text"
    },
    "J_TEXT_AREA": {
        "configElement": {
            "configDatas": [],
            "configType": "textarea"
        },
        "middleName": "textAreaData",
        "middleType": "J_TEXT_AREA",
        "name": "textAreaData",
        "nodeText": {
            "text": "多行文本demo",
            "dataSourceType": 0
        },
        "propertyName": "文本区域",
        "requried": true,
        "type": "text"
    },
    "J_NORMAL_COLOR": {
        "configElement": {
            "configDatas": [],
            "configType": "color"
        },
        "middleName": "colorData",
        "middleType": "J_NORMAL_COLOR",
        "name": "colorData",
        "nodeText": {
            "text": "#E42222",
            "dataSourceType": 0
        },
        "propertyName": "颜色类型",
        "requried": true,
        "type": "text"
    },
    "J_DATE_TIME": {
        "configElement": {
            "configDatas": [],
            "configType": "datetime"
        },
        "middleName": "dateTimeData",
        "middleType": "J_DATE_TIME",
        "name": "dateTimeData",
        "nodeText": {
            "text": "2022-07-07 00:00:00",
            "dataSourceType": 0
        },
        "propertyName": "时间类型",
        "requried": true,
        "type": "text"
    },
    "J_ADV_MATERIAL": {
        "configElement": {
            "configDatas": [
                {
                    "defaultSelect": false,
                    "text": "sku",
                    "value": "1"
                },
                {
                    "defaultSelect": true,
                    "text": "promotion",
                    "value": "2"
                }
            ]
        },
        "height": 390,
        "max": 10,
        "middleName": "bannerData",
        "middleType": "J_ADV_MATERIAL",
        "name": "bannerData",
        "nodeText": {
            "data": [
                {
                    "imageUrl": "//img12.360buyimg.com/cms/jfs/t19237/46/1518239695/166859/bcd8a9dc/5acf5d9fN3cd6a23c.jpg",
                    "w": 375,
                    "h": 187,
                    "x": 0,
                    "y": 0,
                    "detail": {
                        "configDataType": 0
                    },
                    "title": "1"
                },
                {
                    "imageUrl": "//img13.360buyimg.com/cms/jfs/t17683/238/1994351459/169434/aa9bee5a/5ae19e22N98569c80.jpg",
                    "w": 375,
                    "h": 187,
                    "x": 0,
                    "y": 0,
                    "detail": {
                        "configDataValue": {
                            "clickUrl": "javascript:;",
                            "venderId": 176343,
                            "shopId": 170905
                        },
                        "configDataType": 12
                    },
                    "title": "很好的广告"
                },
                {
                    "imageUrl": "//img11.360buyimg.com/cms/jfs/t17779/354/2698166166/429324/61a4efce/5b076ee3N8fc9bd99.jpg",
                    "w": 375,
                    "h": 187,
                    "x": 0,
                    "y": 0,
                    "detail": {
                        "configDataType": 0
                    },
                    "title": "English"
                },
                {
                    "imageUrl": "//img12.360buyimg.com/cms/jfs/t19237/46/1518239695/166859/bcd8a9dc/5acf5d9fN3cd6a23c.jpg",
                    "w": 375,
                    "h": 187,
                    "x": 0,
                    "y": 0,
                    "detail": {
                        "configDataValue": {
                            "clickUrl": "javascript:;",
                            "shopDetail": "176343"
                        },
                        "configDataType": 9
                    },
                    "title": "第二个图片"
                }
            ],
            "max": 4,
            "materialType": 2,
            "materialId": "4m72LCazMQrbF",
            "dataSourceType": 2
        },
        "requried": true,
        "type": "jsonArray",
        "width": 960
    }
}

module.exports = {
    moduleCateTemplate,
    tabTemplate,
    EditPropertyJsonMap,
    ModuleConfigMap,
    ConfigDataMap,
    DataDefinesNodeTextMap
}